package com.app.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 * 签到表
 * </p>
 *
 * @author yoominic
 * @since 2023-12-12
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("tb_sign_in")
public class SignIn {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    private Integer userId;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private LocalDateTime createTime;
    private Integer integral;

    private Date signInDay;
    public SignIn(){
    }

    public SignIn(String day) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        setSignInDay(sdf.parse(day));
    }

    public Date getSignInDay() {
        return signInDay;
    }

    public void setSignInDay(Date signInDay) {
        this.signInDay = signInDay;
    }

}
